<?php include "header.php";?>
	<div id="all">
		<?php
			if($lang == 0){
				$sqlMenu = "Select id, vi_name as name, parent_id,url from tblmenu where id =" .$menuID; 
			}else{
				$sqlMenu = "Select id, en_name as name, parent_id,url from tblmenu where id =" .$menuID; 
			}
			
			$rsMenu = mysql_query($sqlMenu) or die(mysql_error);
			$menu = mysql_fetch_object($rsMenu);

			if($menu->parent_id != 0){
				
				if($lang==0){
					$sqlParentMenu="select id, vi_name as name, parent_id , url from tblmenu where id=" .$menu->parent_id." order by tblmenu.order";
				}else{
					$sqlParentMenu="select id, en_name as name, parent_id,url from tblmenu where id=" .$menu->parent_id." order by tblmenu.order";
				}
				
				$rsParentMenu = mysql_query($sqlParentMenu) or die(mysql_error);
				$parentMenu = mysql_fetch_object($rsParentMenu);
				
			}
			if($lang == 0){
				$sqlChildMenus = "Select id, vi_name as name, url from tblmenu where parent_id =" .$menuID." order by tblmenu.order"; 
			}else{
				$sqlChildMenus = "Select id, en_name as name, url from tblmenu where parent_id =" .$menuID." order by tblmenu.order"; 
			}
			$rsChildMenus = mysql_query($sqlChildMenus) or die(mysql_error);
			
		?>
		<div id="main">
			<div id="m-left">
				<div class="sidebar">
					<div class="title">
						
						<?php
						if($menu->parent_id != 0){ 	
							if($parentMenu->parent_id != 0){ 
							?>
							<a href="<?php echo ROOT_PATH."/m/".$parentMenu->parent_id;?>"><?php echo $parentMenu->name;?></a>
							<?php
							}
							else {
								echo $parentMenu->name;
							}
						}else{
							echo $menu->name;
						}
						?>
					</div>
					<div class="container">
						<ul class="menu-left">
						
	<script type="text/javascript" src="../ddaccordion.js"></script>
<script type="text/javascript">
ddaccordion.init({headerclass:"submenuheader",contentclass:"submenu",revealtype:"mouseover",mouseoverdelay:150,collapseprev:true,defaultexpanded:[],onemustopen:false,animatedefault:false,persiststate:true,toggleclass:["",""],togglehtml:["suffix","",""],animatespeed:"fast",oninit:function(headers,expandedindices){},onopenclose:function(header,index,state,isuseractivated){}})</script>
							<div class="glossymenu">
						<?php
								$arrChildMenu = array();
								while($childMenu = mysql_fetch_object($rsChildMenus)) {
									$arrChildMenu[] = $childMenu;
								}
								if($menu->parent_id !=0){
								
									if($lang == 0){
										$sqlChildMenus1 = "Select id, vi_name as name, url from tblmenu where parent_id =" .$parentMenu->id." order by tblmenu.order"; 
									}else{
										$sqlChildMenus1 = "Select id, en_name as name, url from tblmenu where parent_id =" .$parentMenu->id." order by tblmenu.order"; 
									}
									
									$rsChildMenus1 = mysql_query($sqlChildMenus1) or die(mysql_error);
									while($childMenu1 = mysql_fetch_object($rsChildMenus1)) {
									
										echo "<li>";
									?>								

	<a headerindex="11" class="menuitem submenuheader" href="<?php echo (($childMenu1->url =="")? (ROOT_PATH."/m/".$childMenu1->id) : ROOT_PATH.$childMenu1->url);?>"><?php echo $childMenu1->name;?></a> 
	<?php 
		if($lang == 0){
				$sqlChildMenus2 = "Select id, vi_name as name, url from tblmenu where parent_id =" .$childMenu1->id." order by tblmenu.order"; 
			}else{
				$sqlChildMenus2 = "Select id, en_name as name, url from tblmenu where parent_id =" .$childMenu1->id." order by tblmenu.order"; 
			}
			$rsChildMenus2 = mysql_query($sqlChildMenus2) or die(mysql_error);
			if ($rsChildMenus2) {					
								
		?>
		<div contentindex="11" class="submenu">
		<ul>
		<?php 
			while($childMenu2 = mysql_fetch_object($rsChildMenus2)) {						
								
		?>
			<li><a href="<?php echo (($childMenu2->url =="")? (ROOT_PATH."/m/".$childMenu2->id) : ROOT_PATH.$childMenu2->url);?>"><?php echo $childMenu2->name;?></a></li>	
<?php 
}
?>			
		</ul> 
	</div>		

									<?php
									}									
									echo "</li>";									
									}
								}
								else{
									foreach($arrChildMenu as $childMenu){
									echo "<li>";
									$urllink1= ROOT_PATH."/m/".$childMenu->id;
									?>								<!-- onclick="window.open('<?php echo $urllink1;?>')"-->

	<a headerindex="11" class="menuitem submenuheader" href="<?php echo (($childMenu->url =="")? (ROOT_PATH."/m/".$childMenu->id) : ROOT_PATH.$childMenu->url);?>" ><?php echo $childMenu->name;?></a>
	<?php 
		if($lang == 0){
				$sqlChildMenus2 = "Select id, vi_name as name, url from tblmenu where parent_id =" .$childMenu->id." order by tblmenu.order"; 
			}else{
				$sqlChildMenus2 = "Select id, en_name as name, url from tblmenu where parent_id =" .$childMenu->id." order by tblmenu.order"; 
			}
			$rsChildMenus2 = mysql_query($sqlChildMenus2) or die(mysql_error);
			if ($rsChildMenus2) {	
		?>
		<div contentindex="11" class="submenu">
		<ul>
		<?php 
			while($childMenu2 = mysql_fetch_object($rsChildMenus2)) {														
		?>	<li><a href="<?php echo (($childMenu2->url =="")? (ROOT_PATH."/m/".$childMenu2->id) : ROOT_PATH.$childMenu1->url);?>"><?php echo $childMenu2->name;?></a></li><?php } ?>			
		</ul> 
	</div>					<?php
									}									
									echo "</li>";
									}
									?></div><?php
								}
								
							?>
							
						</ul>
					</div>
				</div>
			</div>
			<div id="m-mid">
				<div class="title">
					<?php if($lang !=0){
						echo $menu->name." menu";
					}else{
						echo $menu->name;
					}?>
				</div>
				<div class="content">
					
						<ul>
						<div class="box">
							<ul>
								<?php
								//lấy các tin tức thuộc menu
								if($lang == 0){
									$sqlFeaturedArticle = "Select id, vi_title as title, vi_summary as summary, created_date From tblarticle where menuid =$menuID AND published = 1 ORDER BY created_date DESC LIMIT 10";
								}else{
									$sqlFeaturedArticle = "Select id, en_title as title, en_summary as summary, created_date From tblarticle where menuid =$menuID AND published = 1 ORDER BY created_date DESC LIMIT 10";
								}
								$rsFeaturedArticle = mysql_query($sqlFeaturedArticle) or die(mysql_error());
								while ($featuredArticle = mysql_fetch_object($rsFeaturedArticle)){
								?>
								<li>
									<a href="<?php echo ROOT_PATH;?>/view/<?php echo $featuredArticle->id;?>"><?php echo $featuredArticle->title;?> <!--<img src="http://istnu.edu.vn/home/images/newnew.gif" width="28" height="16" />--> </a>
									<p class="summary">
										<?php echo $featuredArticle->summary."...";?>
									</p>
									<p class="readmore">
										<a href="<?php echo ROOT_PATH;?>/view/<?php echo $featuredArticle->id;?>"><?php echo ($lang==0)?"Xem tiếp":"Read more";?></a>
									</p>
								</li>
								<?php 
								}
								
								?>
								</ul>
						</div>
						
							
							<?php
								foreach($arrChildMenu as $childMenu){
								?>					
							
							<?php
									// hiển thị bài viết menu con lên
									//echo "<a class='titlena' href='".(($childMenu->url =="")? (ROOT_PATH."/m/".$childMenu->id) : ROOT_PATH .$childMenu->url)."'>".$childMenu->name." :</a>";
									?>
									<div class="box">
							<ul>
									<?php
							//lấy các tin tức thuộc menu
							if($lang == 0){
								$sqlFeaturedArticle = "Select id, vi_title as title, vi_summary as summary, created_date From tblarticle where menuid =".$childMenu->id." AND published = 1 ORDER BY created_date DESC LIMIT 10";
							}else{
								$sqlFeaturedArticle = "Select id, en_title as title, en_summary as summary, created_date From tblarticle where menuid =".$childMenu->id." AND published = 1 ORDER BY created_date DESC LIMIT 10";
							}
							$rsFeaturedArticle = mysql_query($sqlFeaturedArticle) or die(mysql_error());
							while ($featuredArticle = mysql_fetch_object($rsFeaturedArticle)){
							?>
							<li>
								<a href="<?php echo ROOT_PATH;?>/view/<?php echo $featuredArticle->id;?>"><?php echo $featuredArticle->title;?> <!--<img src="http://istnu.edu.vn/home/images/newnew.gif" width="28" height="16" />--> </a>
								<p class="summary">
									<?php echo $featuredArticle->summary."...";?>
								</p>
								<p class="readmore">
									<a href="<?php echo ROOT_PATH;?>/view/<?php echo $featuredArticle->id;?>"><?php echo ($lang==0)?"Xem tiếp":"Read more";?></a>
								</p>
							</li>
							<?php 
							}
							
							?>
							</ul>
						</div>
						</li>
									<?php
									if($lang==0){
										$sqlChildMenu1 = "select id, vi_name as name, url from tblmenu where parent_id = ".$childMenu->id;
									}else{
										$sqlChildMenu1 = "select id, en_name as name, url from tblmenu where parent_id = ".$childMenu->id;
									}
									$rsChildMenus1 = mysql_query($sqlChildMenu1) or die(mysql_error());
									if(mysql_num_rows($rsChildMenus1) > 0){
										//echo "<ul>";
										while($childMenu1 = mysql_fetch_object($rsChildMenus1)){
											//echo "<li class='titlemenu'><a class='titlena' href='".(($childMenu1->url =="")? (ROOT_PATH."/m/".$childMenu1->id) : ROOT_PATH .$childMenu1->url)."'>".$childMenu1->name." :</a>";
											?>
								<div class="box">
								<ul>	
									<?php
							//lấy các tin tức thuộc menu
							if($lang == 0){
								$sqlFeaturedArticle = "Select id, vi_title as title, vi_summary as summary, created_date From tblarticle where menuid =".$childMenu1->id." AND published = 1 ORDER BY created_date DESC LIMIT 10";
							}else{
								$sqlFeaturedArticle = "Select id, en_title as title, en_summary as summary, created_date From tblarticle where menuid =".$childMenu1->id." AND published = 1 ORDER BY created_date DESC LIMIT 10";
							}
							$rsFeaturedArticle = mysql_query($sqlFeaturedArticle) or die(mysql_error());
							while ($featuredArticle = mysql_fetch_object($rsFeaturedArticle)){
							?>
							<li>
								<a href="<?php echo ROOT_PATH;?>/view/<?php echo $featuredArticle->id;?>"><?php echo $featuredArticle->title;?> <!--<img src="http://istnu.edu.vn/home/images/newnew.gif" width="28" height="16" />--> </a>
								<p class="summary">
									<?php echo $featuredArticle->summary."...";?>
								</p>
								<p class="readmore">
									<a href="<?php echo ROOT_PATH;?>/view/<?php echo $featuredArticle->id;?>"><?php echo ($lang==0)?"Xem tiếp":"Read more";?></a>
								</p>
							</li>
							<?php 
							}
							
							?>
								</ul>
								</div>
							
									<?php							
											
										}
										//echo "</ul>";
									}
									echo "</li>";
								}
							?> 
							
							
						
							
						</ul>
					
						
					
				</div>
			</div>
			<div id="m-right">
			
				<div class="sidebar">
					<?php include "newest.php";?>
				</div><!-- end of sidebar -->				
				<?php include "loginlink.php";?>
			</div>
			<div class="clear-fix"></div>
		</div><!--  end of main -->
<?php include "footer.php";?>
	</div>
</body>
</html>